import request from "@/utils/request";
import { DepartQuery, DepartPageResult, DepartForm, Depart } from "./model";

/**
 * 艺术机构API
 */
class DepartAPI {
  /**
   * 获取艺术机构分页数据
   *
   * @param queryParams
   */
  static getPage(queryParams?: DepartQuery) {
    return request<any, DepartPageResult>({
      url:
        "/depart/getPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  static getInfo(data: DepartForm) {
    return request<Depart>({
      url: "/depart/getInfo",
      method: "post",
      data: data,
    });
  }

  /**
   * 新增艺术机构
   *
   * @param data
   */
  static add(data: DepartForm) {
    return request({
      url: "/depart/add",
      method: "post",
      data: data,
    });
  }
  /**
   * 修改艺术机构
   * @param data 
   * @returns 
   */
  static update(data: DepartForm) {
    return request({
      url: "/depart/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除艺术机构
   * @param data 
   * @returns 
   */
  static delete(data: DepartForm) {
    return request({
      url: "/depart/delete",
      method: "post",
      data: data,
    });
  }
}

export default DepartAPI;
